#!/bin/bash
URL=""
Prefix="https://so.gushiwen.cn"
curl -o info.html $URL
grep "李白" info.html > all_about_libai.txt
awk -F '>' '{print $3}' all_about_libai.txt | awk -F '<' '{print $1}' > poem_name.txt
awk -F ' ' '{print $2}' all_about_libai.txt | awk -F '"' '{print $2}' > poem_addr.txt
for line in $(cat poem_addr.txt)
do 
tmp_addr=$Prefix$line
curl $tmp_addr > content.html
grep "meta name=\"description\" content=" content.html > new_content.txt
awk -F '"' '{print $4}' new_content.txt >> poem.txt
done
exec 1<"poem_name.txt"
exec 2<"poem.txt"
echo  "唐诗三百首中李白的式诗歌" >> poem_of_libai.txt
echo >> poem_of_libai.txt
echo >> poem_of_libai.txt
while read line1<&1 && read line2<&2
do
echo $line1 >> poem_of_libai.txt
echo >> poem_of_libai.txt
echo $line2 >> poem_of_libai.txt
echo >> poem_of_libai.txt
echo >> poem_of_libai.txt
done
